﻿<UserControl x:Class="TVersiPlay.MediaBrowse.Views.OneOrTwoMusicView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
              xmlns:igDP="http://infragistics.com/DataPresenter"
	         xmlns:igWindows="http://infragistics.com/Windows"
             xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
             xmlns:ca="clr-namespace:TVersiPlay.Common;assembly=TVersiPlay.Common"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <UserControl.Resources>
        <BooleanToVisibilityConverter x:Key="BoolToVisConverter" />
        
        
        <DataTemplate x:Key="CellImageStyle" >
            <Grid Background="Black" Height="300" Width="400">
                <Grid.RowDefinitions>
                    <RowDefinition Height=".5*" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height=".5*" />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>

                <Image Margin="25" Grid.Row="1" Grid.Column="0" Stretch="Uniform" Source="{Binding DataItem.Icon}" Height="250" Width="250" />
                <Grid Grid.Column="1" Grid.Row="0" Grid.RowSpan="3">
                    <StackPanel Orientation="Vertical">
                        <Label FontWeight="Heavy" Background="Red" Foreground="Gray" HorizontalAlignment="Stretch" HorizontalContentAlignment="Center" Content="{Binding DataItem.MediaName}" />
                        <Label FontWeight="Heavy" Background="Black" Foreground="Gray" HorizontalAlignment="Stretch" HorizontalContentAlignment="Center" Content="{Binding DataItem.Album}" />
                    </StackPanel>
                </Grid>
            </Grid>
        </DataTemplate>
        <Style x:Key="Cell" TargetType="{x:Type ListView}">
            <Setter Property="ItemTemplate">
                <Setter.Value>
                    <DataTemplate>
                        <Grid Background="Black" Height="300" Width="400">
                            <Grid.RowDefinitions>
                                <RowDefinition Height=".5*" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height=".5*" />
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="*" />
                            </Grid.ColumnDefinitions>

                            <Image Margin="25" Grid.Row="1" Grid.Column="0" Stretch="Uniform" Source="{Binding DataItem.Icon}" Height="250" Width="250" />
                            <Grid Grid.Column="1" Grid.Row="0" Grid.RowSpan="3">
                                <StackPanel Orientation="Vertical">
                                    <Label FontWeight="Heavy" Background="Red" Foreground="Gray" HorizontalAlignment="Stretch" HorizontalContentAlignment="Center" Content="{Binding DataItem.MediaName}" />
                                    <Label FontWeight="Heavy" Background="Black" Foreground="Gray" HorizontalAlignment="Stretch" HorizontalContentAlignment="Center" Content="{Binding DataItem.Album}" />
                                </StackPanel>
                            </Grid>
                        </Grid>
                    </DataTemplate>                  
                </Setter.Value>
            </Setter>
        </Style>

        <Style x:Key="MediaNameLabelStyle" TargetType="{x:Type igDP:CellValuePresenter}">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type igDP:CellValuePresenter}">
                        <Label FontWeight="Heavy" Background="Black" Foreground="Gray" HorizontalAlignment="Stretch" HorizontalContentAlignment="Center" Content="{Binding DataItem.MediaName}" />
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <Style x:Key="AlbumLabelStyle" TargetType="{x:Type igDP:CellValuePresenter}">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type igDP:CellValuePresenter}">
                        <Label FontWeight="Heavy" Background="Black" Foreground="Gray" HorizontalAlignment="Stretch" HorizontalContentAlignment="Center" Content="{Binding DataItem.Album}" />
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </UserControl.Resources>

    <Grid Background="Black">
        <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" x:Name="MusicBrowserShell">


            <Grid.RowDefinitions>
                <RowDefinition Height="*"/>                
            </Grid.RowDefinitions>

            <ListView Grid.Row ="0" 
                      Height="400" 
                      HorizontalAlignment="Stretch" 
                      VerticalContentAlignment="Center" 
                      HorizontalContentAlignment="Center" 
                      ItemsSource="{Binding UPnPMediaResults}"
                      ItemTemplate="{StaticResource CellImageStyle}">
                
            </ListView>
            

            <!--<igDP:XamDataCarousel DataSource="{Binding UPnPMediaResults}"
                                          Margin="0,20,0,0" HorizontalAlignment="Stretch" 
                                          VerticalAlignment="Stretch" 
                                          GroupByAreaLocation="None" 
                                          x:Name="albumCarousel"
                                          AutoFit="True" 
                                          Background="Black"
                                          DataSourceResetBehavior="DiscardExistingRecords"
                                          DataContextChanged="OnSourceUpdated"                                         
                                          ActiveDataItem="{Binding Path=ActiveRecord}"
                                          ActiveRecord="{Binding Path=ActiveRecord2}"
                                          SelectedItemsChanging="OnAlbumSelected"
                                          RecordsInViewChanged="OnRecordsInViewChanged"                                          
                                          Grid.Row="0"
                                          Grid.RowSpan="1">

                <igDP:XamDataCarousel.FieldSettings>
                    <igDP:FieldSettings CellClickAction="SelectRecord"/>
                </igDP:XamDataCarousel.FieldSettings>

                <igDP:XamDataCarousel.FieldLayoutSettings>
                    <igDP:FieldLayoutSettings AutoArrangeCells="Never" AutoGenerateFields="False" SelectionTypeRecord="Single"/>
                </igDP:XamDataCarousel.FieldLayoutSettings>

                <igDP:XamDataCarousel.FieldLayouts>
                    <igDP:FieldLayout>
                        <igDP:FieldLayout.Fields>
                            <igDP:Field Name="Icon">
                                <igDP:Field.Settings>
                                    <igDP:FieldSettings CellValuePresenterStyle="" />
                                </igDP:Field.Settings>
                            </igDP:Field>
                        </igDP:FieldLayout.Fields>
                    </igDP:FieldLayout>
                </igDP:XamDataCarousel.FieldLayouts>

              
                </igDP:XamDataCarousel.ViewSettings>
            </igDP:XamDataCarousel>-->




        </Grid>


    </Grid>
</UserControl>
